﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TRPOP.Common;

namespace TRPOP.CMS.Model
{

    /// <summary>
    /// 评论参数信息模型
    /// </summary>
    [Serializable]
    public class RecommentConfigInfo
    {

        #region  私有变量
        bool m_Enable = true;
        bool m_EnableAudit = false;
        int m_Length_UserNameMax = 20;
        int m_Length_ContentMin = 10;
        int m_Length_ContentMax = 2000;
        bool m_EnableTextReplace = true;
        string m_TextReplace = "*";
        string m_TextReplaceList = "胡锦涛,江泽民";
        string m_URL_GetCount = "/publish/RecCount.aspx?id={IndexID}";
        string m_URL_Submit = "/publish/RecSubmit.aspx";
        string m_URL_List = "/publish/RecList.aspx?id={IndexID}&page={Page}";
        string m_URL_CheckCode = "/publish/CheckCodeUrl.aspx";
        string m_FormItem_Name = "recName";
        string m_FormItem_Detail = "recDetail";
        string m_FormItem_Indexid = "indexid";
        string m_FormItem_ValidCode = "recvalidCode";
        #endregion

        #region 成员函数

        /// <summary>
        /// 是否启用审核插件
        /// </summary>
        public bool Enable
        {
            get
            {
                return m_Enable;
            }
            set
            {
                m_Enable = value;
            }
        }
        /// <summary>
        /// 评论是否要经过审核
        /// </summary>
        public bool EnableAudit
        {
            get
            {
                return m_EnableAudit;
            }
            set
            {
                m_EnableAudit = value;
            }
        }

        /// <summary>
        /// 评论用户名最大长度（字节）
        /// </summary>
        public int Length_UserNameMax
        {
            get
            {
                return m_Length_UserNameMax;
            }
            set
            {
                m_Length_UserNameMax = value;
            }
        }

        /// <summary>
        /// 评论内容最小长度（字节）
        /// </summary>
        public int Length_ContentMin
        {
            get
            {
                return m_Length_ContentMin;
            }
            set
            {
                m_Length_ContentMin = value;
            }
        }

        /// <summary>
        /// 评论内容最大长度（字节）
        /// </summary>
        public int Length_ContentMax
        {
            get
            {
                return m_Length_ContentMax;
            }
            set
            {
                m_Length_ContentMax = value;
            }
        }

        /// <summary>
        /// 是否启用字词过滤
        /// </summary>
        public bool EnableTextReplace
        {
            get
            {
                return m_EnableTextReplace;
            }
            set
            {
                m_EnableTextReplace = value;
            }
        }

        /// <summary>
        /// 字词过滤替换字符
        /// </summary>
        public string TextReplace
        {
            get
            {
                return m_TextReplace;
            }
            set
            {
                m_TextReplace = value;
            }
        }

        /// <summary>
        /// 过滤字符列表: 
        /// 多个过滤字符请用逗号“,”分隔
        /// </summary>
        public string TextReplaceList
        {
            get
            {
                return m_TextReplaceList;
            }
            set
            {
                m_TextReplaceList = value;
            }
        }

        /// <summary>
        /// 信息评论数目访问地址
        /// </summary>
        public string URL_GetCount
        {
            get
            {
                return m_URL_GetCount;
            }
            set
            {
                m_URL_GetCount = value;
            }
        }

        /// <summary>
        /// 评论提交页面地址
        /// </summary>
        public string URL_Submit
        {
            get
            {
                return m_URL_Submit;
            }
            set
            {
                m_URL_Submit = value;
            }
        }

        /// <summary>
        /// 评论列表访问地址
        /// </summary>
        public string URL_List
        {
            get
            {
                return m_URL_List;
            }
            set
            {
                m_URL_List = value;
            }
        }

        /// <summary>
        /// 评论验证码地址
        /// </summary>
        public string URL_CheckCode
        {
            get
            {
                return m_URL_CheckCode;
            }
            set
            {
                m_URL_CheckCode = value;
            }
        }

        /// <summary>
        /// 评论提交表单_标题
        /// </summary>
        public string FormItem_Name
        {
            get
            {
                return m_FormItem_Name;
            }
            set
            {
                m_FormItem_Name = value;
            }
        }

        /// <summary>
        /// 评论提交表单_详细内容
        /// </summary>
        public string FormItem_Detail
        {
            get
            {
                return m_FormItem_Detail;
            }
            set
            {
                m_FormItem_Detail = value;
            }
        }

        /// <summary>
        /// 评论提交表单_信息id
        /// </summary>
        public string FormItem_IndexID
        {
            get
            {
                return m_FormItem_Indexid;
            }
            set
            {
                m_FormItem_Indexid = value;
            }
        }

        /// <summary>
        /// 评论提交表单_验证码
        /// </summary>
        public string FormItem_ValidCode
        {
            get
            {
                return m_FormItem_ValidCode;
            }
            set
            {
                m_FormItem_ValidCode = value;
            }
        }
        #endregion

    }
}
/*
    /// <summary>
    /// 评论参数信息模型
    /// </summary>
    public static class RecommentConfigInfoHelper
    {
        static RecommentConfigInfo mRecommentConfigInfo;
        static string m_RecommentConfigFileName = Common.Util.GetMapPath(SystemConst.ConfigRootName + SystemConst.SystemVar_RecommentConfigFileName);
        
        /// <summary>
        /// 评论参数信息
        /// </summary>
        public static RecommentConfigInfo RecommentConfig
        {
            get
            {
                if (mRecommentConfigInfo != null)
                {
                    return mRecommentConfigInfo;
                }
                else
                {

                    if (FileUtil.IsExist(m_RecommentConfigFileName))
                    {
                        mRecommentConfigInfo = SerializationHelper.Load(typeof(RecommentConfigInfo), m_RecommentConfigFileName) as RecommentConfigInfo;
                    }

                    if (mRecommentConfigInfo == null)
                    {
                        mRecommentConfigInfo = new RecommentConfigInfo();

                        SerializationHelper.Save(mRecommentConfigInfo, m_RecommentConfigFileName);
                    }

                    return mRecommentConfigInfo;
                }
            }
        }

        /// <summary>
        /// 设置 评论参数信息
        /// </summary>
        /// <param name="oRecommentConfigInfo"></param>
        /// <returns></returns>
        public static bool SaveRecommentConfig(RecommentConfigInfo oRecommentConfigInfo)
        {
            mRecommentConfigInfo = oRecommentConfigInfo;
            return SerializationHelper.Save(mRecommentConfigInfo, m_RecommentConfigFileName);
        }
    }

    */
